
layui.use(['form'], function () {
    var form = layui.form,
    $ = layui.jquery;
    var loading;
    var userAgent = navigator.userAgent;
    if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1) {
        $(".baoFormBox").css('height',(window.screen.height-215)+"px");
        $(".baoFormBoxTable").css({'height':(window.screen.height-290)+"px"});
     }else{
        $(".baoFormBox").css('height',(window.screen.height-215)+"px");
        $(".baoFormBoxTable").css({'height':(window.screen.height-230)+"px"});
     };
    // 从父级获取列表id
    var id;
    $.each(window.parent.$('.x-iframe'),function(i,v){
        if(v.id!=="postre"&&v.id!="undefined"){
            id=v.id;
        }
    })
    $.ajax({
        url: 'gt/opm/conference/'+id, //请求地址
        type: "GET", //提交的方式S
        dataType: "JSON", //返回类型 TEXT字符串 JSON XML
        beforeSend: function() {
            loading=layer.load(2);
        },
        ContentType:"application/json;charset=UTF-8",
        success: function(data) { 
            layer.closeAll('loading');
            var data=data.data;
            $("#conferenceName").html(data.conferenceName);
            $("#conferenceRoom").html(data.conferenceRoom);
            $("#conferenceLevel").html(data.conferenceLevel);
            $("#conferenceRange").html(data.conferenceRange);
            $("#conferencePeoples").html(data.conferencePeoples);
            //会议时间
            var conferenceDate=data.conferenceDate,
                conferenceDebugDate=data.conferenceDebugDate,
                fileList=JSON.parse(data.fileList),
                deviceSupportList=JSON.parse(data.deviceSupport);
                $("#fileList div").remove();
                $("#conferenceDate div").remove();
                $("#conferenceDebugDate div").remove();
                $("#deviceSupport div").remove();
            for(var a=0; a<conferenceDate.length;a++){
                $("#conferenceDate").append(
                    '<div class="flieSD">'
                    +'<p>'+conferenceDate[a]["startDate"]+' 至 </p>'
                    +'<p>'+conferenceDate[a]["endDate"]+' </p>'
                    +'</div>'
                 )
            }

            for(var b=0; b<conferenceDebugDate.length;b++){
                $("#conferenceDebugDate").append(
                    '<div class="flieSD">'
                    +'<p>'+conferenceDebugDate[b]["startDate"]+' 至</p>'
                    +'<p>'+conferenceDebugDate[b]["endDate"]+' </p>'
                    +'</div>'
                 )
            }
            $("#conferenceRemark").html(data.conferenceRemark);
            $("#conferencePhone").html(data.conferencePhone);
            $("#conferencePeoples").html(data.conferencePeoples);
            $("#conferenceContact").html(data.conferenceContact);//处室
            $("#createDept").html(data.createDept);//处室
            // 会议通知
            for(var c=0; c<fileList.length;c++){
                $("#fileList").append(
                    '<div class="flieSD">'
                    +'<span>'+fileList[c]["fileName"]+'</span>'
                    +'<a  data-fpath="'+fileList[c]["filePath"]+'" data-fname="'+fileList[c]["fileName"]+'"   title="下载"   class="layui-btn download" ><img src="../images/download.png" style="width:100%"></a>'
                    +'</div>'
                 )
            }

            for(var d=0; d<deviceSupportList.length;d++){
                $("#deviceSupport").append(
                    '<span style="margin-left:5px">'+deviceSupportList[d]["value"]+'</span>'
                )
            }
            
            $("#description").html(data.description);
            // 下载
            $(".download").on("click",function(){
                var fileName=encodeURIComponent($(this).data("fname"));
                    filePath=$(this).data("fpath") ;
                var url='gt/opm/file/download?fileName='+fileName+'&filePath='+filePath;
                $(this).attr("href",url)
            })
        }
    })
})

